package org.chengyi.model_shop.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.chengyi.model_shop.entity.User;

@Mapper
public interface LoginMapper {
    @Select("SELECT * FROM user WHERE username = #{username}")
    User findByUsername(String username);
    @Insert("INSERT INTO user (username, password, email, phone, address, role, created_at)" +
            " VALUES (#{username}, #{password}, #{email}, #{phone}, #{address}, #{role}, #{createdAt})")
    int register(User user);
    @Select("SELECT * FROM user WHERE email = #{email}")
    User findByEmail(String email);
}